<?php
defined('SW_') or die('Access Error');

switch(SW::request('act','get')){
	
	//升级程序
	case 'upgrade':

		//初始化升级类
		$objUpgrade=new SWUpgrade();
		$strErr='';

		$account=SWFunc::checkString(SW::request('account','post'));
		$password=SWFunc::checkString(SW::request('password','post'));

		//验证账户和密码
		if(!SWAdmin::checkAccount($account,md5($password))){
			
			$strErr=LANG('Invalid_Account_Or_Password');

		}else{

			//执行升级操作
			if(!$objUpgrade->upgrade()) $strErr=LANG('Setup_Error_Upgrade');

		}

		//如果以上都没有错误
		if(!$strErr){
			
			SWAdmin::postJson(LANG('Upgrade Succeed'),0);

		}else{

			SWAdmin::postJson($strErr,1);

		}

	break;

}

?>
